package com.gcxy.springmybatisplustest.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "orders")
public class Orders {
    @TableId(value = "id", type = IdType.AUTO)
    @NotNull(message = "订单编号不能为空")
    private Integer id;

    private String orderNumber;

    /*   - `0` 表示“待支付”

         - `1` 表示“已支付”

         - `2` 表示“已发货”

         - `3` 表示“已完成”*/
    private Integer status;

    @NotNull(message = "用户ID不能为空")
    private Integer userId;

    @Min(value = 1,message = "商品数量必须大于0")
    private Integer quantity;

    @DecimalMax(value = "10000.00",message = "商品价格最大为10000")
    @DecimalMin(value = "0.01",message = "商品价格不能低于0.01")
    private double price;
}
